#ifndef MAJESTIC_H_INCLUDED
#define MAJESTIC_H_INCLUDED
#include <SFML/graphics.hpp>
#include <SFML/Audio.hpp>
#include <SFML/System.hpp>
#include <list>
#include <string>
using namespace std;
class Majestic
{
    public:
	class Object
	{
	private:
        sf::Sprite spr;
        sf::Texture Texture;
		int objectid;
	public:
        Object();
        Object(int tx,int ty,const char *img);
		int getx();
		int gety();
		int getw();
		int geth();
		void setx(int tx);
		void sety(int ty);
		void setpos(int tx, int ty);
		void move(int x,int y);
		void setw(int tw);
		void seth(int th);
		int setimg(const char *file);
		int getid();
		void setid(int id);
		virtual sf::Sprite &getsprite();
	};
    class Slate
    {
        private:
            int xid;
            int yid;
        public:
            void addobject(Object& o1);
            void removeobject(int objectid);
            list<Majestic::Object>& draw();
    };
    class Stream : public sf::SoundStream
    {
        virtual bool OnStart();
        virtual bool OnGetData(Chunk& Data);
        void open(const char *file);
    };
	class Sound
	{
	private:
		bool isfull();
		sf::Sound sound;
		sf::SoundBuffer tmpbuffer;
		void run();

	public:
		Sound();
		int queue(const char *file);
		void play(const char *file);
		void play(int id);
		void setvolume(int volume);
		void stop();
		void clear();

	};
	class Player
	{
	private:
		int speed;
		int pos;
        sf::Sprite pspr[8];
        sf::Texture pImage[8];
	public:
		Player();
		Player(int tx,int ty,const char *img1,const char *img2,const char *img3,const char *img4,const char *img5,const char *img6,const char *img7,const char *img8);
		void setspeed(int s);
		int getspeed();
		void move(int x, int y);
        sf::Sprite &getsprite();
        void changepos(int p);
        int getpos();
	};
	class Screen
	{
	private:
		int width;
		int height;
		int xsize;
		int ysize;
		struct mouse
		{
		    int button;
		    int x;
		    int y;
		};
		sf::RenderWindow App;
        Majestic::Slate **mtab;
        sf::Texture **itab;
        sf::Sprite **stab;
        sf::View camera;
        Majestic::Player *player;

	public:
		Screen(int w,int h,int xsize,int ysize);
		Screen();
		bool isOpened();
		void activate();
		void disactivate();
		bool pause(float ms);
		void refresh();
		void setbg(const char *path);
		void drawbg();
		void addtxt(const char *text, const char *pfont,int size, int r, int g, int b,int x, int y);
		void quit();
		bool isColide(Object o1, Object o2);
		void addslate(int sx, int sy,Slate &s);
		void addobject(int sx,int sy, Object &o1);
		void drawobjects();
		void drawplayer();
		void addplayer(Player &p1);
		void moveplayer(int x, int y);
        bool getstart();
		int getkey();
		int getstate();
		mouse getmouse();
		int get();
		void setcamera(int x,int y);
		void movecamera(int x,int y);
		void zoom(float s);


	};
};


#endif // MAJESTIC_H_INCLUDED
